#pragma once

#include <QtCore/QObject>
#include <QtWidgets/QLabel>

#include <nodes/QNodeDataModel>

#include <iostream>

using Qt::PortType;
using Qt::PortIndex;
using Qt::QtNodeData;
using Qt::NodeDataType;
using Qt::QtNodeDataModel;
using Qt::NodeValidationState;

/// The model dictates the number of inputs and outputs for the Node.
/// In this example it has no logic.
class NumberDisplayDataModel : public QtNodeDataModel
{
  Q_OBJECT

public:
  NumberDisplayDataModel();

  virtual
  ~NumberDisplayDataModel() {}

public:

  QString
  caption() const override
  { return QStringLiteral("Result"); }

  bool
  captionVisible() const override
  { return true; }

  bool hotkeyEnabled() const override {
	  return false;
  }

  QString
  name() const override
  { return QStringLiteral("Result"); }

public:

  unsigned int
  nPorts(PortType portType) const override;

  NodeDataType
  dataType(PortType portType,
           PortIndex portIndex) const override;

  std::shared_ptr<QtNodeData>
  outData(PortIndex port) override;

  void
  setInData(std::shared_ptr<QtNodeData> data, int) override;

  QWidget *
  embeddedWidget() override { return _label; }

  NodeValidationState
  validationState() const override;

  QString
  validationMessage() const override;

private:

  NodeValidationState modelValidationState = NodeValidationState::Warning;
  QString modelValidationError = QStringLiteral("Missing or incorrect inputs");

  QLabel * _label;
};
